function login() {
    var adminName = $("#adminName").val();
    var adminPwd = $("#adminPwd").val();
    $.ajax({
        url: '/yuepai/admin/login.action',
        data: {
            adminName: adminName,
            adminPwd: adminPwd
        },
        type: 'post',
        dataType: 'json',
        cache: false,
        beforeSend: LoadFunction, //加载执行方法
        error: errorFunction,  //错误执行方法
        success: succFunction //成功执行方法
    });

    function succFunction(res) {
        console.log(res);
        if (res.status == 200){
            layer.msg("登录成功");
            window.location.href = "/yuepai/admin/index";
        }else {
            layer.msg(res.message);
        }
    }
}

//回车键登陆
$(function () {
    $(document).keydown(function (e) {
        if (e.keyCode === 13) {
            $("#loginBtn").click();
        }
    });
});